home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NetNews Offline 2
/
NetNews Offline Volume 2.iso
/
news
/
comp
/
std
/
c
/
420
< prev
next >
Wrap
Internet Message Format
|
1996-08-06
|
962b
Path: solon.com!not-for-mail
From: msb@sq.com
Newsgroups: comp.std.c,comp.lang.c.moderated
Subject: Re: Integral promotion.
Date: 17 Feb 1996 12:06:45 -0600
Organization: SoftQuad Inc., Toronto, Canada
Sender: clc@solutions.solon.com
Approved: clc@solutions.solon.com
Message-ID: <4g55fl$avl@solutions.solon.com>
References: <4fstj7$2l6@solutions.solon.com> <4fvgvb$e0t@solutions.solon.com>
NNTP-Posting-Host: solutions.solon.com
> > short test(short x1, short x2) {
> > short result;
> > result = x1 + x2;
>
> The addition operator "+" converts your short operands to ints.
No, just using their values does that. The operator + never sees
operands narrower than int. In the statement
x1;
the short is converted to int before being discarded.
--
Mark Brader, msb@sq.com | "Ah, determinism (likewise, forgetfulness) reigns."
SoftQuad Inc., Toronto | --Steve Summit
My text in this article is in the public domain.